<?php
/**
 * Created by PhpStorm.
 * User: lhl
 * Date: 2020/11/3
 * Time: 15:45
 * Features: 主机端口
 */

namespace app\adminapiv3\model;


class HostPortModel extends BaseModel
{
    /**
     * 根据主机id查询端口列表
     * @param string $hostIds 主机id,逗号隔开字符串
     * @param string $field   查询字段
    */
    public function getListByHostId($hostIds,$field = 'p.*,h.name'){
        return $this->alias('p')
            ->leftJoin('host h','p.host_id=h.id')
            ->whereIn('host_id',$hostIds)->field($field)->select()->toArray();
    }

}